{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1594
  Verdict: Accepted
}
uses 
	SysUtils, Math;
 
var
	i,j,n,kk,cur,rr,cc,m:longint;
	a:array[0..20,0..20] of longint;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
fillchar(a,sizeof(a),0);
read(n,m);
kk:=n*m;
cur:=1;
rr:=n;
cc:=m;
i:=1;
j:=1;
while cur<=kk do begin
	while (cur<=kk) and (j<=cc) do begin
		a[i][j]:=cur;
		inc(j);
		inc(cur);
	end;
	dec(j);
	inc(i);
	cc:=m-cc+1;
	while (cur<=kk) and (i<=rr) do begin
		a[i][j]:=cur;
		inc(i);
		inc(cur);
	end;
	dec(i);
	dec(j);
	rr:=n-rr+2;
	while (cur<=kk) and (j>=cc) do begin
		a[i][j]:=cur;
		dec(j);
		inc(cur);
	end;
	inc(j);
	dec(i);
	cc:=m-cc;
	while (cur<=kk) and (i>=rr) do begin
		a[i][j]:=cur;
		dec(i);
		inc(cur);
	end;
	inc(i);
	inc(j);
	rr:=n-rr+1;	
end;
for i:=1 to n do begin 
	for j:=1 to m do
		write(a[i][j],' ');
	writeln;
end;
end.